package util

import (
	enum "mall/service/backend/common/enum/setting"
)

const (
	MemberRankRuleTypeDiscount string = "订单金额优惠"
	MemberRankRuleTypeFreeShipping string = "包邮"
	MemberRankRuleTypeExtraPoint string = "额外赠送积分"
	MemberRankRuleTypeCoupon string = "赠送宝石券"
	MemberRankRuleTypeGems string = "返宝石"
	MemberRankRuleTypeCustomerService string = "专属客服"
	MemberRankRuleTypeNewArrivalExperience string = "新品体验"
)

func GetUserRankRuleTypeText(ruleType *uint32) (res string) {
	if ruleType != nil {
		switch uint8(*ruleType) {
		case enum.MemberRankRuleTypeDiscount:
			res = MemberRankRuleTypeDiscount
		case enum.MemberRankRuleTypeFreeShipping:
			res = MemberRankRuleTypeFreeShipping
		case enum.MemberRankRuleTypeExtraPoint:
			res = MemberRankRuleTypeExtraPoint
		case enum.MemberRankRuleTypeCoupon:
			res = MemberRankRuleTypeCoupon
		case enum.MemberRankRuleTypeGems:
			res = MemberRankRuleTypeGems
		case enum.MemberRankRuleTypeCustomerService:
			res = MemberRankRuleTypeCustomerService
		case enum.MemberRankRuleTypeNewArrivalExperience:
			res = MemberRankRuleTypeNewArrivalExperience
		}
	}

	return
}

const (
	MemberRankRuleModeAmount string = "满减"
	MemberRankRuleModeDiscount string = "满折"
	MemberRankRuleModeFixed string = "固定金额"
)

func GetUserRankRuleModeText(ruleMode *uint32) (res string) {
	if ruleMode != nil {
		switch uint8(*ruleMode) {
		case enum.MemberRankRuleModeAmount:
			res = MemberRankRuleModeAmount
		case enum.MemberRankRuleModeDiscount:
			res = MemberRankRuleModeDiscount
		case enum.MemberRankRuleModeFixed:
			res = MemberRankRuleModeFixed
		}
	}

	return
}

const (
	MemberRankRulePeriodTypeDay string = "每天"
	MemberRankRulePeriodTypeWeek string = "每周"
	MemberRankRulePeriodTypeMonth string = "每月"
	MemberRankRulePeriodTypeYear string = "每年"
	MemberRankRulePeriodTypeUnique string = "唯一"
	MemberRankRulePeriodTypeBirthday string = "生日"
)

func GetUserRankPeriodTypeText(periodType *uint32) (res string) {
	if periodType != nil {
		switch uint8(*periodType) {
		case enum.MemberRankRulePeriodTypeDay:
			res = MemberRankRulePeriodTypeDay
		case enum.MemberRankRulePeriodTypeWeek:
			res = MemberRankRulePeriodTypeWeek
		case enum.MemberRankRulePeriodTypeMonth:
			res = MemberRankRulePeriodTypeMonth
		case enum.MemberRankRulePeriodTypeYear:
			res = MemberRankRulePeriodTypeYear
		case enum.MemberRankRulePeriodTypeUnique:
			res = MemberRankRulePeriodTypeUnique
		case enum.MemberRankRulePeriodTypeBirthday:
			res = MemberRankRulePeriodTypeBirthday
		}
	}

	return
}
